﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Navigation;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Telerik.Examples.WP;

namespace TestMatrix.Phone.JumpList
{
    public partial class BugUserControl : UserControl
    {
        private List<MovieViewModel> items;
        public BugUserControl()
        {
            InitializeComponent();
            this.jumpList.ItemsSource = this.GetItems();
            //this.jumpList.Margin = new Thickness(10, 100, 10, 10);
        }

        private List<MovieViewModel> GetItems()
        {
            using (XmlReader xmlReader = XmlReader.Create("JumpList/NetFlixTop50.xml"))
            {
                XmlSerializer deserializer = new XmlSerializer(typeof(List<MovieViewModel>));
                List<MovieViewModel> movies = deserializer.Deserialize(xmlReader) as List<MovieViewModel>;

                return movies;
            }
        }

        private void jumpList_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            //string text = ((TextBlock)e.OriginalSource).Text;

            // RadJumpList rjl = (RadJumpList)sender;
            // ((TextBlock)e.OriginalSource).Text;

            // TextBlock txb =
            //     rjl.FindName("txb_Type") as TextBlock;
            //// txb.Text=
            //text = ((TextBlock)this.jumpList.GroupDescriptors[1]).Text;
            //TextBlock texttest = (TextBlock)this.jumpList.FindName("txb_Type");
            //this.jumpList.SelectedValue.ToString();
        }
    }
}
